package com.kayt.cyberBar.cpublic.business.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kayt.cyberBar.common.PageData;
import com.kayt.cyberBar.common.ServerResponse;
import com.kayt.cyberBar.cpublic.business.entity.po.CPublicShift;
import com.kayt.cyberBar.cpublic.business.entity.req.vo.PublicShiftReqVO;
import com.kayt.cyberBar.cpublic.business.entity.rsp.vo.PublicShiftRspVO;
import com.kayt.cyberBar.cpublic.business.server.IPublicShiftServer;
import com.kayt.cyberBar.cpublic.business.service.IPublicShiftService;

@Service("publicShiftService")
public class PublicShiftServiceImpl implements IPublicShiftService {
	@Autowired
	private IPublicShiftServer publicShiftServer;

	@Override
	public ServerResponse<PageData<PublicShiftRspVO>> getShiftList(PublicShiftReqVO shiftReqVO) {
		PageData<CPublicShift> shiftPageData = publicShiftServer.get_shift_list(shiftReqVO.getPageNum(),shiftReqVO.getPageSize(),shiftReqVO.getStoreCode());
		return publicShiftServer.assemble_result_list(shiftPageData);
	}

	@Override
	public ServerResponse<PublicShiftRspVO> addShift(PublicShiftReqVO shiftReqVO) {
		CPublicShift shift = publicShiftServer.add_shift(shiftReqVO);
		return publicShiftServer.assemble_result(shift);
	}

	@Override
	public ServerResponse<PublicShiftRspVO> updateShift(PublicShiftReqVO shiftReqVO) {
		CPublicShift shift = publicShiftServer.mod_shift(shiftReqVO);
		return publicShiftServer.assemble_result(shift);
	}

	@Override
	public ServerResponse<String> deleteShift(String shiftId) {
		Integer result = publicShiftServer.del_shift(shiftId);
		return publicShiftServer.assemble_result_string(result);
	}
}
